﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM.CSS.SAC.Conditions
{
    #region Using Statements

    using KLF.Lib.Browser.DOM.HTML;

    #endregion
    /// <summary>
    /// Checks to see if an element is enabled (by checking for lack of disabled).
    /// </summary>
    public class PseudoEnabled : Condition
    {
        public override ConditionType Type
        {
            get { return ConditionType.PsueodoClassCondition; }
        }

        public override bool MatchElement(KLF.Lib.Browser.DOM.HTML.HTMLElement e)
        {
            if (HTMLBool.Eval(
                    e.getAttribute(HTMLConstants.HTML_ATT_DISABLED), 
                    HTMLConstants.HTML_ATT_DISABLED))
                return false;
            return true;
        }

        public override string ToString()
        {
            return ":enabled";
        }
    }
}
